package com.bawei.module_player.adapter

import com.bawei.module_player.PlayerEntity
import com.bawei.module_player.R
import com.bawei.module_player.adapter.provider.*
import com.chad.library.adapter.base.BaseProviderMultiAdapter

/**
 * @Author : yaotianxue
 * @Time : On 2023/6/2 11:01
 * @Description : PlayerAdapter
 */
class PlayerAdapter:BaseProviderMultiAdapter<PlayerEntity.Item>() {
    init {
        addItemProvider(TitleViewProvider(0, R.layout.player_titlte_view))
        addItemProvider(VideoCardProvider(1, R.layout.player_video_card))
        addItemProvider(ReplayProvider(3, R.layout.player_replay_view))
        addItemProvider(EmptyProvider(-1, R.layout.player_empty_view))

    }
    override fun getItemType(data: List<PlayerEntity.Item>, position: Int): Int {
        return when(data[position].type){
            "textCard"-> 0
            "videoSmallCard"-> 1
            "leftAlignTextHeader"->0
            "reply"->3
            else -> -1
        }
    }

}